<?php
	require_once("pre.php");
	require_once("auth.php");
	
	if(!isset($action)) $action="";
	
?>
<?php if(! est_autorise("acces_configuration")) exit; ?>
<?php
	require_once("../classes/Devise.class.php");

	if($action == "modifier"){
		$devise = new Devise();

 		$devise->charger($id);
 		$devise->nom = $nom;	
 		$devise->taux = $taux;	
		$devise->symbole = htmlentities($symbole);
		$devise->code = $code;
 		$devise->maj();
 
		header("Location: devise.php");
	}		
	
	else if($action == "ajouter"){
		
		$devise = new Devise();

 		$devise->nom = $nnom;	
 		$devise->taux = $ntaux;	
		$devise->symbole = $nsymbole;
		$devise->code = $ncode;
 		$devise->add();		

		header("Location: devise.php");
	}

	else if($action == "supprimer"){
		
		$devise = new Devise();
 		$devise->charger($id);
 		$devise->delete();		

		header("Location: devise.php");
	}
	
	else if($action == "refresh"){
		$devise = new Devise();
		$devise->refresh();
		
		header("location: devise.php");
	}	
?>
